import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import * as actionMethods from "./actions.js";
import * as mutationMethods from "./mutations.js";
import * as getterMethods from "./getters.js";

Vue.use(Vuex)
const store = new Vuex.Store({
	state: {
		vuex_config: {
			themeColor1: '#F34D4E',
			price: '#E55C27',
			adminTheme: '#3297ef',
			adminPrice: '#FF1212',
			errImg: 'https://klwl-file.oss-cn-shenzhen.aliyuncs.com/202104/jhstest/52320344224983.png',
			userPage: 1,
			isAuction: 0,
			videoSwiper: false,
			showOrderRefund: false,
			isExamine: 0,
			sales_volume: 1,
			union_pay: 0,
			subtitle: 0,
			comment: 1,
			reading_volume: 1,
			withdraw_explain: '',
			account_login: 1,
			self_mention: 0,
			showAdmin: true,
			catering_menu: '',
			contact: true,
		},
		noAuth: ['/package/product/counterfeiting/index'],
		process: 0,
		vuex_businessObj: {
			appid:'wx5c8336988414bd3a',
			// resquest:'https://cc1.pos08.com',
			resquest:'http://192.168.2.13:44368',
			adminRes:'https://cc2.pos08.com',
			webUrl:'cc.pos08.com'
		},
		vuex_router_query: {},
		proShopPayList: [],
		vuex_user: {},
		vuex_adminuser: {},
		vuex_count: {},
		vuex_business: {
			pk_id: ''
		},
		vuex_token: '',
		vuex_superior: '0',
		vuex_login_back_url: '',
		vuex_host: 'localhost:8099',
		vuex_meal_list: [],
		vuex_tab_bar_default: {
			list: [{
					query: {},
					iconPath: 'e63d',
					selectedIconPath: 'e63c',
					text: '首页',
					url: 'index'
				},
				{
					query: {},
					iconPath: 'e742',
					selectedIconPath: 'e742',
					text: '分类',
					url: 'category',
				},
				{
					query: {},
					iconPath: 'e73d',
					selectedIconPath: 'e73c',
					text: '购物车',
					url: 'cart'
				},
				{
					query: {},
					iconPath: '/static/tab/user.png',
					selectedIconPath: '/static/tab/user_fill.png',
					text: '我的',
					url: 'user'
				},

			],
			activeColor: '#e93324',
			inactiveColor: '#666666',
			current: 0
		},
		vuex_tab_bar: {
			list: [],
			activeColor: '',
			inactiveColor: '',
			current: 0
		},
		vuex_tab_page: [
			"/pages/index/index",
			"/pages/module-page-one/index",
			"/pages/module-page-two/index",
			"/pages/module-page-three/index",
			"/pages/module-page-four/index"
		],
		vuex_system: {
			contH: 0,
			top: 0,
		},
		vuex_login: false,
		vuex_cart_list: [],
		vuex_cart_num: 0,
		vuex_address: null,
		vuex_pick: null,
		vuex_tab_params: null,
		vuex_hotel_search: {},
		park_area_list: [{
				label: '嘉和名庭小区',
				value: 'dkxHcqSlvGy3pMND',
				choice: '1',
			},
			{
				label: '洛维科技孵化园',
				value: 'zId5m8oUNnP5Q5YK',
				choice: '2',
			}
		],
		my_community: {},

	},
	mutations: mutationMethods,
	actions: actionMethods,
	getters: getterMethods,
	plugins: [
		// 缓存
		createPersistedState({
			paths: ['vuex_user', 'vuex_token', 'vuex_login_back_url', 'vuex_address', 'vuex_pick',
				'vuex_hotel_search', 'vuex_adminuser',
				'vuex_meal_list', 'park_area_list', 'my_community'
			],
			storage: {
				getItem: key => uni.getStorageSync(key),
				setItem: (key, value) => uni.setStorageSync(key, value),
				removeItem: key => uni.removeStorageSync(key)
			}
		})
	]
})

export default store
